<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="database.DAO"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
	DAO dao = DAO.getInstance();
	int charNo = Integer.parseInt(request.getParameter("deleteChar"));
	System.out.println("선택한 캐릭터는 : " + charNo);
	
	//session.setAttribute("charNo", charNo );
	
	//삭제할 대상의 캐릭터가 지금 세션에 선택되어 있다면 세션삭제
	if( session.getAttribute("charNo") != null && (Integer)session.getAttribute("charNo") == charNo ){
		session.removeAttribute("charNo");
		System.out.println("삭제할 캐릭터이므로 charNo(" + charNo + ")세션 삭제 완료!");
	}
	if( dao.deleteCharacter( charNo ) )
	{
		System.out.println("정상적으로 캐릭터 " + charNo + "가 삭제되었습니다!");
	}
	response.sendRedirect("../jsp/manageCharacter.jsp");

%>
</body>
</html>